// pages/loupan/zaixianlist.js
var app =getApp()
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		modalName:'',
		picker:[
			'男','女'
		],
		value:'男',
		searchvalue:'',
    zaixian:'',
    limit:5,
	},

	showModal(e) {
		this.setData({
			modalName: e.currentTarget.dataset.target
		})
	},
	hideModal(e) {
		this.setData({
			modalName: null
		})
	},
	PickerChange(e) {
		console.log(e);
		var name = this.data.picker[e.detail.value]
		this.setData({
			value: name
		})
	},
	/**
	 * 生命周期函数--监听页面加载
	 */

  zaixian(limit) {
    var that = this;
    var setid = app.globalData.cityCode;
		app.core('get', 'get_zx_more_list/site_id/' + setid + '/limit/'+limit+'', '', (res => {
      console.log(res, '在线订房')
      var limits = limit +5
      that.setData({
        zaixian: res.data,
        limit: limits
      })
    }))
  },

	onLoad: function (options) {
      this.zaixian(6)
	},

	/**
	 * 生命周期函数--监听页面初次渲染完成
	 */
	onReady: function () {

	},

	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow: function () {

	},

	/**
	 * 生命周期函数--监听页面隐藏
	 */
	onHide: function () {

	},

	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload: function () {

	},

	/**
	 * 页面相关事件处理函数--监听用户下拉动作
	 */
	onPullDownRefresh: function () {

	},

	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function () {
    var that =this;
    var limit = that.data.limit;
    that.zaixian(limit)
	},

	/**
	 * 用户点击右上角分享
	 */
	onShareAppMessage: function () {

	},

	searchlist(e) {
		this.setData({
			searchvalue: e.detail.value
		})
	},

	searchdesc() {
		return;
		var that = this;
		var setid = app.globalData.cityCode;
		var searchvalue = that.data.searchvalue;
		if (searchvalue == '') {
			wx.showToast({
				title: '请输入内容',
				duration: 1000,
				icon: 'none'
			})
		} else {
			app.core('get', 'search_loupan_by_name/site_id/' + setid + '', {
				project_name: searchvalue
			}, (res) => {
				console.log(res)
			})
		}

	},

})
